package org.maxgroundstation.groundstation.view.map;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;

import org.maxgroundstation.groundstation.view.overlay.TextDisplayUtil;

/**
 * A map overlay for displaying a north direction indicator.
 * @author Scott Davis
 * 
 * Copyright (C) 2010  Scott Davis
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
public class NorthIndicatorMapOverlay implements MapOverlay {

    // The overlay ID.
    public static final String OVERLAY_ID = "North Indicator";
    
    /**
     * Constructor
     */
    public NorthIndicatorMapOverlay() {
        
    }
    
    @Override
    public void drawMapOverlay(String baseMapStyle, Graphics2D g2d, GpsLocation currentLoc, int width, 
            int height, float zoom) {
        
        // Draw 'N' character.
        Font saveFont = g2d.getFont();
        g2d.setFont(g2d.getFont().deriveFont(Font.BOLD, 20));
        String nText = "N";
        int textWidth = g2d.getFontMetrics().stringWidth(nText);
        int xCenter = width / 2;
        int xPos = xCenter - (textWidth / 2);
        int yPos = 25;
        TextDisplayUtil.drawText(nText, xPos, yPos, g2d);
        g2d.setFont(saveFont);
    }

    @Override
    public boolean isDraggable() {
        return false;
    }
}